import type { MysteryInfo } from '@/types/index.ts';
import RandomFetcher from './random-fetcher.ts';
import { imageList } from './common.ts';
export const fragments:MysteryInfo[] = [
  {
    id: 0,
    title: '微前端',
    subtitle: '坤乾、父子通信、沙箱、svg图标问题',
    link: 'https://mp.weixin.qq.com/s/cm9xOIUK-YVwdTZuIVcTWw',
  },
  {
    id: 1,
    title: '自动生成前端路由',
    subtitle: 'vite中自动生成前端路由',
    link: '',
  },
  {
    id: 2,
    title: '失败重试',
    subtitle: '脚本加载失败重试',
    link: '',
  },
  {
    id: 3,
    title: '任务队列',
    subtitle: '任务队列的中断和恢复',
    link: '',
  },
  {
    id: 4,
    title: 'vue2、vue3响应式',
    subtitle: 'Proxy和DefineProperty',
    link: '',
  },
  {
    id: 5,
    title: '前端打开文件夹',
    link: '',
  },
  {
    id: 6,
    title: '打包工具配置',
    subtitle: 'base、publicPath、publicDir',
    link: '',
  },
  {
    id: 7,
    title: '异步传染性',
    subtitle: '消除异步传染性',
    link: '',
  },
  {
    id: 8,
    title: '虚拟DOM',
    subtitle: '你真的理解虚拟DOM吗？',
    link: '',
  },
  {
    id: 9,
    title: '绝对路径和相对路径',
    subtitle: '绝对路径和相对路径',
    link: '',
  },
  {
    id: 10,
    title: '数据的流式获取',
    subtitle: '数据的流式获取',
    link: '',
  },
  {
    id: 11,
    title: 'plugins',
    subtitle: '开发中的几个好用plugins',
    link: '',
  },
  {
    id: 12,
    title: '数据共享',
    subtitle: '夸标签页数据共享',
    link: '',
  },
  {
    id: 13,
    title: '请求取消',
    subtitle: '请求取消',
    link: '',
  },
  {
    id: 14,
    title: 'Ajax进度',
    subtitle: '控制Ajax的进度，并获取各部分数据',
    link: '',
  },
]

export const imageFetcher = new RandomFetcher(imageList, 'name');
export const getFragmentsData = () => {
  fragments.forEach(item => {
    item.img = imageFetcher.getNext().module as string;
  })
  return fragments
}
